package com.ybdz.scanner.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.ybdz.scanner.R;
import com.ybdz.scanner.base.BaseActivity;
import com.ybdz.scanner.utils.MyApplication;
import com.ybdz.scanner.utils.SPUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @ClassName: AccountActivity
 * @author: zhao
 * @Description: 账户中心
 * @date 2018/2/24 9:59
 */
public class AccountActivity extends BaseActivity {

    @BindView(R.id.usename)
    TextView mUsename;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_logining);
        ButterKnife.bind(this);
        String name = SPUtils.getString(AccountActivity.this, "usename", "deUseName");
        if (!name.equals("deUseName") || !name.isEmpty()) {
            mUsename.setText(name);
        }
    }

    @OnClick({R.id.back, R.id.quit})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.back:         //返回
                finish();
                break;
            case R.id.quit:         //退出登录
                SPUtils.saveString(AccountActivity.this, "usename", null);
                MyApplication.setIsLogin(false);
                startActivity(new Intent(AccountActivity.this, LoginActivity.class));
                this.finish();
                break;
        }
    }
}
